<ui:composition template="template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

	<ui:define name="headerMenu">
		<c:choose>
			<c:when test="#{userBean.loggedIn}">
				<div id="userMenu">
					<div id="submitButton">
						<a onclick="displaySubmitLinkBox()" class="headerlinks">Submit
							New Link</a>
					</div>

					<div id="userOptions">
						<h:outputText value="Hi #{userBean.name}, you are logged in!"></h:outputText>
						<h:form id="formLogout" style="display:inline;">
							<h:commandLink value="Logout" id="logout"
								action="${userBean.logOut}" styleClass="headerlinks" />
						</h:form>
					</div>
				</div>
			</c:when>

			<c:otherwise>
				<div id="guestMenu">
					<h:form id="formLogin">
						<h:outputLabel for="username" value="Username" />
						<p:inputText id="username" value="#{userBean.username}" />
						<h:outputLabel for="password" value="Password" />
						<p:password id="password" value="#{userBean.password}" />
						<p:commandLink value="Register" id="register"
							onclick="displayRegisterBox()" styleClass="headerlinks" />
						<p:commandLink value="Login" id="login" action="#{userBean.login}"
							styleClass="headerlinks" />
					</h:form>

				</div>
			</c:otherwise>
		</c:choose>
	</ui:define>
</ui:composition>